﻿using System;

namespace 观察者模式
{
    /// <summary>
    /// 观察者:老鼠
    /// </summary>
    internal class Mouse
    {
        private string name;
        private string color;

        public Mouse(string name, string color)
        {
            this.name = name;
            this.color = color;
        }

        public Mouse(string name, string color, Cat cat)
        {
            this.name = name;
            this.color = color;
            cat.CatComeEvent += RunAway;
        }

        public void RunAway()
        {
            Console.WriteLine(color + "颜色老鼠：" + name + "跑了");
        }
    }
}